using System;
using UnityEngine;
using System.Collections;


public class FleeBehaviour : SteeringBehaviour
{
	public FleeBehaviour ()
	{
		
	}
	
	private void print(string s)
	{
		MonoBehaviour.print(s);	
	}	

	private void print(Vector3 v)
	{
		MonoBehaviour.print(v);	
	}	
	
	public override Vector3 getSteering (AgentBehaviourScript agent)
	{	
		//double distToNearestHerder = agent.getDistanceToNearestHerder();
		if (agent.getNearestHerder() == null)
			return agent.getPosition(); // Why would we be evading if we didn't know where a herder was
		Vector3 vecToHerder = agent.getNearestHerder().getPosition() - agent.getPosition();
		Vector3 newPos = agent.getPosition() - (vecToHerder.normalized * 3000);
		newPos.y = agent.getPosition().y;
		return newPos;
	}
	
	const int fleePackRange = 700;
	
	public Vector3 getFleeFromHerdSteering (AgentBehaviourScript agent, Vector3 position)
	{
		return agent.getPosition() + ((agent.getPosition() - position).normalized * fleePackRange);
	}
}
